<template>
	<view class="content">
		<!-- 返回主页 -->
		<view class="back" @click="back">
			<!-- <view>Back</view> -->
			<view class="backicon"></view>
		</view>
		<view v-if="messageInfo.length==0" style="position: absolute;">
			<u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png"
				style="position: absolute; margin-top: 1200rpx;">
			</u-empty>
		</view>
		<view style="margin-top: 150rpx;">
			<u-list height="1300rpx">
				<u-list-item v-for="i in  messageInfo" :key="i">
					<view class="msgcard">
						<view class="text1">
							<text style="float: left;color:#868686;">举报人:</text>
							<view style="text-overflow: ellipsis;overflow: hidden;
								white-space: nowrap; float: left;
								width: 200rpx;margin-left: 20rpx;">
								<text>{{i.sname}}</text>
							</view>
							<text style="color:#868686;">教师名:</text>
							<view style="text-overflow: ellipsis;overflow: hidden;
								white-space: nowrap;
								width: 200rpx;float: right;">
								<text>{{i.nickname}}</text>
							</view>
						</view>
						<view class="text1" style="margin-top: 10rpx;">
							<text style="float: left;color:#868686;">课程名称:</text>
							<view style="text-overflow: ellipsis;overflow: hidden;
								white-space: nowrap; float: left;
								width: 460rpx;margin-left: 20rpx;">
								<text>{{i.coursename}}</text>
							</view>
							<view style="margin-top: 10rpx;float: left;">
								<text style="color:#868686;">迟到日期:</text>
								<text style="margin-left: 20rpx;">{{i.delaydate}}</text>
							</view>
						</view>
						<view class="text1" style="float: left;margin-top: 10rpx;width: 95%;">
							<text style="color:#868686;">详细信息:</text>
							<text style="margin-left: 20rpx;">{{i.remarks}}</text>
						</view>
						<view style="float: left;width: 100%;padding-bottom: 30rpx;margin-top: 20rpx;">
							<button v-if="i.status==0" @click="give(i.id)" class="shanbaobtn">通过</button>
							<view v-else-if="i.status==1" style="margin-left: 20rpx;">
								<view class="tag-view">
									<uni-tag :inverted="true" text="已通过" type="success" />
								</view>
							</view>
							<button v-if="i.status==0" @click="goout(i.id)" class="bohuibtn">不通过</button>
							<view v-else-if="i.status==2" style="margin-left: 20rpx;">
								<view class="tag-view">
									<uni-tag :inverted="true" text="未通过" type="error" />
								</view>
							</view>

						</view>
					</view>
				</u-list-item>
			</u-list>

		</view>

	</view>
</template>

<script>
	import {
		AVATARURL,
		HNIT_URL,
		MONITOR,
		STUNAME,
		USERNAME,
		IDENTITY,
		TNAME,
		SESSION_KEY,
		OPENID,
		WXNAME
	} from "@/constants/index.js";
	import {
		data
	} from '../../../uni_modules/uview-ui/libs/mixin/mixin';
	export default {

		data() {
			return {
				//课程名
				coursename: "",
				//教师名
				tname: "",
				//迟到日期
				delaydate: "",
				//详细信息
				remarks: "",
				//存储信息对象
				messageInfo: [],
				//举报人
				sname: ""
			};
		},
		methods: {
			//查询举报信息
			queryTeaInfo() {
				let stuid = uni.getStorageSync(USERNAME)
				let params = {
					stuid: stuid
				}
				this.$request.post(HNIT_URL + "wx/queryInfoTea", params).then(res => {
					this.messageInfo = res.data
				})
			},

			//做处理  通过 
			give(id) {
				let params = {
					id: id
				}
				this.$request.post(HNIT_URL + "wx/updateTeaStatus", params).then(res => {
					uni.showToast({
						title: res.msg,
						icon: "none",
						duration: 1500
					})
					this.queryTeaInfo();
				}, err => {
					uni.showToast({
						title: "操作超时",
						duration: 1500
					})
				})
			},
			//返回主页
			back() {
				uni.redirectTo({
					url: "/pages/student/my/index"
				})
			},
			//未通过处理 
			goout(id) {
				let params = {
					id: id
				}
				this.$request.post(HNIT_URL + "wx/updateTeaStatusFalse", params).then(res => {
					uni.showToast({
						title: res.msg,
						icon: "none",
						duration: 1500
					})
					this.queryTeaInfo();
				}, err => {
					uni.showToast({
						title: "操作超时",
						icon: "none",
						duration: 1500
					})
				})
			},
		},
		onLoad() {
			this.queryTeaInfo();
		}
	}
</script>

<style lang="scss">
	.text1 {
		font-weight: bold;
		margin-top: 10rpx;
		margin-left: 20rpx;
		font-size: 35rpx;
	}

	.bohuibtn {
		width: 200rpx;
		height: 80rpx;
		background-color: white;
		float: right;
		margin-right: 20rpx;
		font-weight: bold;
		color: #868686;
		border-radius: 40rpx;
		line-height: 80rpx;
		box-shadow: 0px 2px 6px 0px #cecece;
	}

	.u-empty__text data-v-0d5b1156 {
		position: absolute;
		margin-top: 1500rpx;
	}

	.backicon {
		background-image: url("data:image/svg+xml,%3Csvg t='1689146294791' class='icon' viewBox='0 0 1024 1024' version='1.1' xmlns='http://www.w3.org/2000/svg' p-id='19508' width='200' height='200'%3E%3Cpath d='M501.30944 464.22016c0-19.99872-16-35.19488-35.99872-35.99872H310.4V350.62784L137.61536 464.22016l171.98592 113.59232V500.21888h155.70944c19.99872-0.79872 35.99872-16 35.99872-35.99872z' fill='%23005CFF' p-id='19509'%3E%3C/path%3E%3Cpath d='M886.38464 212.01408c0-39.46496-31.99488-71.45984-71.45984-71.45984H443.88864c-39.46496 0-71.45984 31.99488-71.45984 71.45984v117.69856a29.42464 29.42464 0 1 0 58.84928 0V225.00352a25.6 25.6 0 0 1 25.6-25.6h358.05184c2.72384 0 5.23264 0.88576 7.296 2.3552l-252.50816 91.904c-15.872 5.77536-28.74368 29.28128-28.74368 52.49536v382.88384H456.87808a25.6 25.6 0 0 1-25.6-25.6V598.7328a29.42464 29.42464 0 1 0-58.84928 0v117.69856c0 39.46496 31.99488 71.45984 71.45984 71.45984h97.08544v62.68928c0 23.21408 12.86656 37.3504 28.74368 31.57504l287.42144-104.61184c15.872-5.77536 28.74368-29.28128 28.74368-52.49536v-0.39424c0.3072-2.69824 0.50688-5.43232 0.50688-8.2176v-504.4224z' fill='%23005CFF' p-id='19510'%3E%3C/path%3E%3C/svg%3E");
		background-size: cover;
		width: 50rpx;
		height: 50rpx;
		margin-top: 6rpx;
		margin-left: 12rpx;
	}

	.back {
		position: fixed;
		/* color: #0055ff; */
		width: 80rpx;
		margin-top: -1200rpx;
		height: 55rpx;
		margin-left: -640rpx;
		border-radius: 80rpx;
		background-color: white;
		/* line-height: 60rpx; */
		/* text-align: center; */
		/* font-weight: bold; */
		border: 1rpx #c6c6c6 solid;
	}

	.shanbaobtn {
		width: 200rpx;
		height: 80rpx;
		background-color: white;
		float: left;
		margin-left: 20rpx;
		font-weight: bold;
		color: #868686;
		border-radius: 40rpx;
		line-height: 80rpx;
		box-shadow: 0px 2px 6px 0px #cecece;
	}

	page {
		background-color: #F0F0F0;
	}

	.msgcard {
		margin-left: 40rpx;
		margin-top: 45rpx;
		background-color: white;
		width: 90%;
		// height: 300rpx;
		border-radius: 40rpx;
	}

	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
</style>